<?php
/*Class avec les configurations pour e-DSL*/

class edslLdap extends LdapAuth{
	public function __construct($options = null)
	{
		if(is_null($options)){
			$options = array();
		}
		if(strpos(sfConfig::get('app_ldapRoot_ldapHost'), 'gardian')!==false){
			$use_ldaps = true;
			$search_attributes = array('cn', 'sn', 'mail', 'uid', 'givenname', 'employeeType', 'departmentNumber');
		}else{
			$use_ldaps = false;
			$search_attributes = array('cn', 'sn', 'mail', 'uid', 'givenname', 'rhsdum');
		}
		
		$login_options = array(
			'servers' 			=> array(sfConfig::get('app_ldapRoot_ldapHost')),
			'bind_dn'			=> sfConfig::get('app_ldapRoot_ldapLogin'),
			'bind_pwd'			=> sfConfig::get('app_ldapRoot_ldapPassword'),
			'use_ldaps'			=> $use_ldaps,
			//'searchBase'		=> 'ou=people,dc=gardiansesame',
			'searchBase'		=> sfConfig::get('app_ldapRoot_ldapBase'),
			'searchAttributes'	=> $search_attributes,
			'port'				=> sfConfig::get('app_ldapRoot_ldapPort', 636),
		);
		$newoptions = array_merge($options,$login_options);
		parent::__construct($newoptions );
	}
}
